package com.atguigu.lease.web.admin.custom.converter;

import com.atguigu.lease.model.enums.ReleaseStatus;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * ClassName : StringToReleaseStatusConverter
 * Package: com.atguigu.lease.web.admin.convert
 * Description:
 *
 * @Author 李轩辕
 * @Create 6/4/2024 下午5:13
 * @Version 17.0
 */
//@Component
public class StringToReleaseStatusConverter implements Converter<String, ReleaseStatus> {

    @Override
    public ReleaseStatus convert(String source) {
        // 自定义的转换逻辑，将字符串转换为枚举类型
        // 这里可以根据实际情况实现不同的转换逻辑
        return ReleaseStatus.valueOf(source.toUpperCase()); // 假设枚举类型的名称与传递的字符串相同
    }
}